$(document).ready(function () {
    $.get("/ShenBlue/imp/User_Msg_Json", function (data) {
        if (IsEmpty(data.name)) {
            window.location.assign("/userInfoService/updateUserInfo.html");
        }
    });
    $("#header").load("Nav.html #Nav", function () {
        element.init();
        $("#UserMsg").addClass("layui-this");
    });
});


function ModifyPassWord() {
    const oldPwd = $("#OldPwd").val();
    const NewPwd = $("#newPwd").val();
    const RePwd = $("#RePwd").val();
    if (IsEmpty(oldPwd, NewPwd, RePwd)) {
        layer.msg("禁止为空", {icon: 5});
        return;
    }
    if (NewPwd != RePwd) {
        layer.msg("请确认密码是否输入正确", {icon: 5});
        return;
    }
    $.post("/ShenBlue/imp/ModifyUser", {mode: 2, NewPwd: NewPwd, OldPwd: oldPwd}, function (data) {
        const error = data["error"];
        const msg = data["msg"];
        if (error !== undefined) {
            layer.msg(error, {icon: 5});
            setTimeout("location.reload()", 1500);
            return;
        }
        layer.msg(msg, {icon: 1});
        setTimeout("location.reload()", 1500);
        return;
    });
}